#!/bin/sh
NOW=`date '+%Y%m%d_%H%M%S'`
APPLICATION=caipus

git pull

go build src/$APPLICATION.go

kill -9 $(ps -ef|grep $APPLICATION |gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')

mkdir -p dist
mkdir -p dist/backups

mv dist/**.* dist/backups

cp $APPLICATION  dist/$APPLICATION.$NOW
rm $APPLICATION

cd dist
nohup ./$APPLICATION.$NOW &> $APPLICATION.$NOW.log&

#mvn clean package
#
#kill -9 $(ps -ef|grep $SERVICE |gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')
#
#mkdir -p dist
#mkdir -p dist/backups
#
#mv dist/*.jar dist/backups
#mv dist/*.log dist/backups
#
#cp target/$SERVICE.jar  dist/$SERVICE-$NOW.jar
#
#cd dist
#
#nohup java -jar $SERVICE-$NOW.jar &> $SERVICE-$NOW.log&